package acm.华中农业;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class D {
    public static void main(String[] args) throws IOException {
        TreeSet<Node> set=new TreeSet<>();
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        sc.nextLine();
        long k=n/2+1;
        String[] read = sc.nextLine().split(" ");
        for (int i = 0; i < read.length; i++) {
            Node node = new Node(i + 1, Integer.parseInt(read[i]));
            if (set.size()<k){
                set.add(node);
            }else if (set.last().compareTo(node)>0){
                set.pollLast();
                set.add(node);
            }
        }
        long sum=0;
        List<Long> list=new ArrayList<>();
        for (Node node : set) {
            sum+=node.price;
            list.add(node.rank);
        }
        System.out.println(sum);
        List<Long> collect = list.stream().sorted().collect(Collectors.toList());
        StringBuilder sb=new StringBuilder();
        for (Long o : collect) {
            sb.append(o).append(" ");
        }
        System.out.println(sb.substring(0,sb.length()-1));
    }
    static class Node implements Comparable{
        long rank;
        long price;

        public Node(long rank, long price) {
            this.rank = rank;
            this.price = price;
        }

        @Override
        public int compareTo(Object o) {
            Node node = (Node) o;
            if (price== node.price){
                return (int) (rank-node.rank);
            }
            return (int) (price- node.price);
        }
    }
}
